package org.urchr.beorganized.api.impl;

import org.urchr.beorganized.api.base.PrivateBaseAPIServlet;
import org.urchr.beorganized.dao.NotesDAO;
import org.urchr.beorganized.dao.XMLDocumentBuilder;
import org.urchr.beorganized.dao.errors.GeneralException;

public class MoveUp extends PrivateBaseAPIServlet {

	@Override
	protected void doProcessPrivate() throws GeneralException {
		int noteID = NotesDAO.safeInt(request.getParameter("noteid"), -1);
//		System.out.println("Moving note up: ");
		int parentID = NotesDAO.moveNoteUp(userID, noteID);
		XMLDocumentBuilder doc = new XMLDocumentBuilder();
		doc.getRootElement("note").setAttribute("id", ""+noteID);
		doc.getRootElement("note").setAttribute("parentid", ""+parentID);
		sendNode(doc.getRootElement());
		
	}

}
